<?php
	include "../ketnoi.php";
	$SoHDTC = $_POST["SoHDTC"];
	$MaKH = $_POST["MaKH"];
	$NguoiThuaKe = $_POST["NguoiThuaKe"];
	$NgaySinh = $_POST["NgaySinh1"];
	$DiaChi = $_POST["DiaChi1"];
	$SoCMND = $_POST["SoCMND1"];
	$NgayCap = $_POST["NgayCap1"];
	$NoiCap = $_POST["NoiCap1"];
	$SoQSDD = $_POST["SoQSDD"];
	$NoiCapDat = $_POST["NoiCapDat"];
	$NgayCapDat = $_POST["NgayCapDat"];
	$ThuaDatSo = $_POST["ThuaDatSo"];
	$ToBanDoSo = $_POST["ToBanDoSo"];
	$TongDienTich = $_POST["TongDienTich"];
	$GiaTriTaiSan = $_POST["GiaTriTaiSan"];
	$MucChoVay = $_POST["MucChoVay"];
	
	$taisanthechap = new taisanthechapbs();

	$sql = "UPDATE taisanthechap set MaKH = '$MaKH', NguoiThuaKe = '$NguoiThuaKe', NgaySinh = '$NgaySinh', DiaChi = '$DiaChi', SoCMND = '$SoCMND', NgayCap = '$NgayCap', NoiCap = '$NoiCap', SoQSDD = '$SoQSDD', NoiCapDat = '$NoiCapDat', NgayCapDat = '$NgayCapDat', ThuaDatSo = '$ThuaDatSo', ToBanDoSo = $ToBanDoSo, TongDienTich = $TongDienTich, GiaTriTaiSan = $GiaTriTaiSan, MucChovay = $MucChoVay WHERE SoHDTC = '$SoHDTC'";
	
	
	$kq = mysql_query($sql);
	if($kq)
	{
		session_start();
		$nhatky = new nhatkybs();
		$nhatky->TenSuKien = "Sửa thông tin hợp đồng thế chấp";
		$nhatky->MaNguoiDung = $_SESSION["MaND"];
		date_default_timezone_set('Asia/Ho_Chi_Minh');
		$nhatky->ThoiGian = date("Y-m-d H:m:s", time());
		$nhatky->Them();
		header("Location:index.php?do=taisanthechap&id=$SoHDTC");
	}
	else 
	{
		$_SESSION["LoiSuaTaiSanTheChap"]= "Lỗi ".mysql_error();
		header("Location:index.php?do=taisanthechap");
	}
?>